<template>
  <div class="app">
    <h3>我是app组件,{{ name }}--{{ price }}</h3>
    <Child />
  </div>
</template>

<script>
import Child from './components/Child.vue'
import { reactive, toRefs, provide } from 'vue'
export default {
  name: 'app',
  components: {
    Child
  },
  setup() {
    let car = reactive({
      name: 'bwm',
      price: '40k'
    })

    provide('car', car) //给自己的后代组件传递数据
    return {
      ...toRefs(car)
    }
  }
}
</script>

<style>
.app {
  background-color: pink;
  padding: 10px;
}
</style>
